package com.ctfo.ulcp.exp.db;

import com.ctfo.ulcp.exp.core.WeaviateEmbeddingStore;
import dev.langchain4j.model.embedding.BgeSmallZhEmbeddingModel;

import java.util.List;

import static com.ctfo.ulcp.exp.db.Constants.*;

public class ResourceManagerFactory {

    public static ResourceManager resourceManagerForProject(int projectId) {
        System.out.println("objectClass:" + "project_" + projectId);

//        var embeddingModel = new BgeSmallZhQuantizedEmbeddingModel();
        var embeddingModel = new BgeSmallZhEmbeddingModel();
        var embeddingStore = WeaviateEmbeddingStore.builder()
                .apiKey("")
                .scheme("http")
                .host("172.20.60.5:8080")
                .objectClass("Project_" + projectId)//必须首字母大写
                .metadataKeys(List.of(META_KEY_RES_ID, META_KEY_SOURCE_TYPE, META_KEY_SOURCE_ID))//值必须全部小写
                .avoidDups(false)
                .consistencyLevel("ALL")
                .build();


        return new ResourceManager(embeddingModel, embeddingStore);
    }

}
